<!DOCTYPE html>
<html>

	<head>
		<meta charset="UTF-8">
		<meta name="viewport" content="initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<title></title>
		<link rel="stylesheet" type="text/css" href="h-ui-font/iconfont.min.css" />
		<link rel="stylesheet" type="text/css" href="css/jquery-weui.min.css" />
		<link rel="stylesheet" type="text/css" href="css/weui.min.css" />
		<script src="js/jquery-2.1.4.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/jquery-weui.min.js" type="text/javascript" charset="utf-8"></script>
		<script src="js/vue(1).js" type="text/javascript" charset="utf-8"></script>
		<style type="text/css">
			body {
				width: 100%;
				margin: 0px auto;
				min-width: 320px;
				max-width: 640px;
				position: relative;
			}
			
			.top {
				width: 100%;
				height: 120px;
				min-width: 320px;
				max-width: 640px;
				line-height: 50px;
				color: white;
				font-size: 18px;
				text-indent: 5px;
				overflow: hidden;
				background-color: #0F88EB;
			}
			
			.top a {
				color: white;
				display: inline-block;
				margin-right: 5px;
			}
			
			.top a:last-child {
				float: right;
				font-size: 24px;
				font-weight: bold;
				margin-right: 10px;
			}
			
			.title {
				width: 100%;
				height: 30px;
				text-indent: 10px;
				font-size: 18px;
				color: white;
				position: absolute;
				top: 50px;
				background-color: #0F88EB;
				text-overflow: ellipsis;
				overflow: hidden;
				white-space: nowrap;
			}
			.title h1{
				color: white !important;
				text-indent: 10px !important;
				font-size: 18px !important;
				background-color: #0F88EB !important;
				text-overflow: ellipsis !important;
				overflow: hidden !important;
				white-space: nowrap !important;
			}
			.contents {
				width: 100%;
				box-sizing: border-box;
				padding-top: 80px;
				padding-bottom: 50px;
				overflow: auto;
				padding-left: 10px;
				padding-right: 10px;
				font-size: 14px;
				color: black;
			}
			.contents img{
				width: 100%;
			}
			.weui-tabbar {
				min-width: 320px;
				max-width: 640px;
				height: 50px;
				position: fixed;
			}
			
			.weui-tabbar__icon {
				margin-top: -4px;
			}
			
			.people {
				width: 90%;
				height: 50px;
				overflow: hidden;
				background-color: white;
				line-height: 50px;
				padding: 10px;
				position: absolute;
				top: 85px;
				bottom: 0px;
				left: 0px;
				right: 0px;
				margin: 0px auto;
				z-index: 1000;
				box-shadow: 0px 1px 1px #c0c0c0;
			}
			
			.people div {
				float: left;
			}
			
			.people div:first-of-type {
				width: 40px;
				height: 40px;
				border: 1px solid #e0e0e0;
				border-radius: 20px;
				overflow: hidden;
				margin-top: 5px;
			}
			
			.people div:first-of-type img {
				height: 100%;
			}
			
			.people div:last-of-type {
				width: 70px;
				height: 30px;
				text-align: center;
				margin-top: 10px;
				cursor: pointer;
				color: #0F88EB;
				border: 1px solid;
				line-height: 30px;
				float: right;
			}
			
			.people div:nth-of-type(2) {
				font-size: 18px;
				margin-left: 10px;
			}
			
			.people div:last-of-type i {
				margin-right: 5px;
			}
			
			.active0:before {
				color: #0F88EB;
			}
			.active1:before {
				color: red;
			}
			.active2:before {
				color: orange;
			}
		</style>
	</head>

	<body>
		<div class="top">
			<a href="index.html" class="Hui-iconfont Hui-iconfont-slider-left"></a>回答
			<a href="" class="Hui-iconfont Hui-iconfont-more"></a>

		</div>
		<div class="title" v-html="json1[2][0].title"></div>
		<div class="people">
			<div class="peopleImg"><img :src="json1[2][0].n_zan" /></div>
			<div v-html="json1[2][0].n_time"></div>
			<div v-html="guanzhu" v-on:click="guanzhu1()">关注</div>
		</div>
		<div class="contents" v-html="json1[2][0].context">

		</div>

		<div class="weui-tabbar">
			<a href="JavaScript:;" class="weui-tabbar__item" v-on:click="zan()">
				<div class="weui-tabbar__icon">
					<i class="Hui-iconfont Hui-iconfont-zan2" v-bind:class="{'active0':iszan}"></i>
				</div>
				<p class="weui-tabbar__label">赞</p>
			</a>
			<a href="JavaScript:;" v-on:click="thank()" class="weui-tabbar__item">
				<div class="weui-tabbar__icon">
					<i class="Hui-iconfont Hui-iconfont-like" v-bind:class="{'active1':isthank}"></i>
				</div>
				<p class="weui-tabbar__label">感谢</p>
			</a>
			<a href="JavaScript:;" v-on:click="shoucang()" class="weui-tabbar__item">
				<div class="weui-tabbar__icon">
					<i class="Hui-iconfont Hui-iconfont-cang" v-bind:class="{'active2':iscollect}"></i>
				</div>
				<p class="weui-tabbar__label">收藏</p>
			</a>
			<a href="comment.html" v-click="pinglun()" class="weui-tabbar__item">
				<div class="weui-tabbar__icon">
					<i class="Hui-iconfont Hui-iconfont-leijipingjia"></i>
				</div>
				<p class="weui-tabbar__label" v-html="json1[2][0].n_ping">2</p>
			</a>
		</div>
		<script type="text/javascript">
			//接URL参数
			var loc = location.href;
			var n1 = loc.length; //地址的总长度
			var n2 = loc.indexOf("="); //取得=号的位置
			var index = decodeURI(loc.substr(n2 + 1, n1 - n2)); //从=号后面的内容
			//接URL参数
			var ss;
			var dd;
			

			var vue = new Vue({
				el: "body",
				data: {
					json1: [],
					isguanzhu: false,
					guanzhu: "关注",
					iszan: false,
					isthank: false,
					iscollect: false
				},
				methods: {
					guanzhu1: function() {
						vue.isguanzhu = !vue.isguanzhu;
						
						if(vue.isguanzhu) {
							vue.guanzhu = "已关注";
						} else {
							vue.guanzhu = "关注";
						}
					},
					auth: function() {
						$.ajax({
							type: 'get',
							//async:false,
							url: "http://v2.mashupcloud.cn/developer/auth.do",
							data: {
								appkey: 'FvWrIYOQoTUYVbscUNQoQAVqsLnZqKEN',
								appsecret: 'ugCfcSmyLkcbCGfIuFOPEgTgPQPbyJSE'

							},
							success: function(json) {
								//		            console.log(json);
								ss = JSON.parse(json)[1];
								dd = JSON.parse(json)[2];
								vue.content();
							},
							error: function(json) {

								console.log("err:" + json);

							}
						});
					},
					content: function() {
						$.ajax({
							type: 'get',
							url: "http://v2.mashupcloud.cn/SQL/sele_tie_id/",
							data: {
								appid: dd,
								token: ss,
								name: 'sele_tie_id',
								_v1: index
							},
							success: function(json) {
								vue.json1 = JSON.parse(json);
								console.log(vue.json1[2][0])
								userid = vue.json1[2][0].user_id;
								for(var i = 0; i < vue.json1[2].length; i++) {
									$.ajax({
										type: "get",
										url: "http://v2.mashupcloud.cn/SQL/sele_user/",
										async: false,
										data: {
											appid: dd,
											token: ss,
											name: 'sele_user',
											_v1: userid
										},
										success: function(json) {
											console.log(JSON.parse(json)[2]);
											vue.json1[2][i].n_time = JSON.parse(json)[2][0].nicheng;
											vue.json1[2][i].n_zan = JSON.parse(json)[2][0].touxiang;
										}
									});
								}
								sessionStorage.setItem("contentid",index)
							},
							error: function(json) {
								console.log("err:" + json);

							}
						});

						

					},
					zan: function() {
						if(sessionStorage.getItem("username")) {
							$.ajax({
								type: 'get',
								url: "http://v2.mashupcloud.cn/SQL/upda_tie_zan/",
								data: {
									appid: dd,
									token: ss,
									name: 'upda_tie_zan',
									_v1: 1,

								},
								success: function(json) {
									console.log("json==" + json);
									vue.iszan = !false;

								},
								error: function(json) {
									console.log("err:" + json);

								}
							});
						} else {
							location.href = "regist.login.html"
						}
					},
					thank: function() {
						if(sessionStorage.getItem("username")) {
							vue.isthank = !false;
						} else {
							location.href = "regist.login.html"
						}
					},
					shoucang: function() {
						if(sessionStorage.getItem("username")) {
							vue.iscollect = !false;
							$.ajax({
								type: 'get',
								url: "http://v2.mashupcloud.cn/SQL/add_coll/",
								data: {
									appid: dd,
									token: ss,
									name: 'add_coll',
									_v1: sessionStorage.getItem("username"),
									_v2: index
								},
								success: function(json) {
									console.log("json==" + json);
									vue.iszan = !false;

								},
								error: function(json) {
									console.log("err:" + json);

								}
							});
						} else {
							location.href = "regist.login.html"
						}
					},
					pinglun:function(){
						location.href = "comment.html?" + "index=" + encodeURI(index);
					}
				}
			});
			vue.auth();
		</script>
	</body>

</html>